//mongodb node的驱动程序
const mongoose = require("mongoose");
//引入 执行model
require("../db/model/tabs");
//初始化数据(生成商品大类导航)
const tabs = [
  { navsId: "61a4f3fbdf30ee68cc8bb186", name: "常温奶" },
  { navsId: "61a4f3fbdf30ee68cc8bb186", name: "低温奶" },
  { navsId: "61a4f3fbdf30ee68cc8bb186", name: "面包糕点" },
  { navsId: "61a4f3fbdf30ee68cc8bb186", name: "其它乳品" },

  { navsId: "61a4f3fbdf30ee68cc8bb187", name: "啤酒" },
  { navsId: "61a4f3fbdf30ee68cc8bb187", name: "红酒" },
  { navsId: "61a4f3fbdf30ee68cc8bb187", name: "白酒" },
  { navsId: "61a4f3fbdf30ee68cc8bb187", name: "调味酒" },

  { navsId: "61a4f3fbdf30ee68cc8bb188", name: "饮用水" },
  { navsId: "61a4f3fbdf30ee68cc8bb188", name: "碳酸饮料" },
  { navsId: "61a4f3fbdf30ee68cc8bb188", name: "功能饮料" },
  { navsId: "61a4f3fbdf30ee68cc8bb188", name: "茶饮料" },
  { navsId: "61a4f3fbdf30ee68cc8bb188", name: "果汁饮料" },
  { navsId: "61a4f3fbdf30ee68cc8bb188", name: "风味饮料" },

  { navsId: "61a4f3fbdf30ee68cc8bb189", name: "膨化食品" },
  { navsId: "61a4f3fbdf30ee68cc8bb189", name: "美味肉类" },
  { navsId: "61a4f3fbdf30ee68cc8bb189", name: "馋嘴素食" },
  { navsId: "61a4f3fbdf30ee68cc8bb189", name: "坚果" },
  { navsId: "61a4f3fbdf30ee68cc8bb189", name: "干果蜜饯" },
  { navsId: "61a4f3fbdf30ee68cc8bb189", name: "中式糕点" },


];
//建立连接
mongoose.connect(
  "mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/maiwenjie-project",
  {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    auth: { authSource: "admin" },
  },
  async () => {
    const tabsModel = mongoose.model("tabs"); //创建model
    const data = await tabsModel.create(tabs); //调用create方法
    console.log(data);
  }
);
